package com.maisuiit.singleton;

/**
 * 单例模式-静态内部类
 *      解决了按需加载、线程安全的问题，同时实现简洁
 * @Author: zhangcc
 * @CreateTime: 2024-02-05
 */
public class Singleton05 {

    // 1. 私有构造方法
    private Singleton05() {
    }
    private static class SingletonHandler{
        private static Singleton05 instance = new Singleton05();
    }

    public static Singleton05 getInstance(){
        return SingletonHandler.instance;
    }
}
